package InnerclassTestDemo;
/**
 * Created with IntelliJ IDEA.
 * Description:静态内部类
 * User: 石方旭
 * Date: 2022-03-31
 * Time: 17:25
 */
class OutClass2 {
    public String data1 = "厚积薄发Outclass";
    public int data2 = 5;
    public double data3 = 0.1;
    public static int count1 =9;
    //静态内部类
    static class StaticInnerClass {
        public String data4 = "厚积薄发Innerclass";
        public int data5 = 520;
        public double data6 = 13.14;
        public static int count2 =999;
    }
    //外部类如何访问内部类成员呢？？？
    public  void methodOut() {
        //通过实例化内部类，然后通过内部类对象的引用访问内部类对象
        StaticInnerClass staticInnerClass = new StaticInnerClass();
        System.out.println(staticInnerClass.data4);
        System.out.println(staticInnerClass.data5);
        System.out.println(staticInnerClass.data6);
        System.out.println(staticInnerClass.count2);
    }
}
public class TestDemo2 {
    public static void main(String[] args) {
        //外部类类名  变量名  = new 外部类类名();
        OutClass2 outclass2 =new OutClass2();//实例外部类
         //如何实例化内部类
        OutClass2.StaticInnerClass staticInnerClass= new OutClass2.StaticInnerClass();
       // staticInnerClass.methodInner();
        System.out.println("=====================");
        //outclass2.methodOut();
    }
}
